package com.peng.utils;

import java.util.HashMap;
import java.util.Map;
import org.apache.commons.text.StringSubstitutor;
import org.junit.jupiter.api.Test;

/**
 * ShelfupSuccessSqlTest
 * 招才猫鸿蒙
 *
 * @author lupeng10
 * @create 2024-09-11 14:36
 */
public class ShelfupSuccessSqlTest {

    @Test
    public void test1() {
        String sqlTem = """
                insert into `t_decision_scene` (`id`,`unikey`,`terminal`,`name`,`source`,`state`,`created_at`,`created_by`,`updated_at`,`updated_by`,`opportunity`,`field_supported`) values('${sceneId}','${sceneKey}',NULL,'${sceneName}','0','1','2024-09-11 14:42:04','lupeng10','2024-09-11 14:42:04','lupeng10','1',NULL);
                
                insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id1}','1','productType','商品类型','8','${sceneId}','[{\\"disabled\\":false,\\"label\\":\\"超级置顶\\",\\"value\\":\\"1\\"},{\\"disabled\\":false,\\"label\\":\\"畅聊权益\\",\\"value\\":\\"2\\"},{\\"disabled\\":false,\\"label\\":\\"超级畅聊职位\\",\\"value\\":\\"3\\"},{\\"disabled\\":false,\\"label\\":\\"超级畅聊职位月度包\\",\\"value\\":\\"4\\"},{\\"disabled\\":false,\\"label\\":\\"超级畅聊职位-安心招\\",\\"value\\":\\"5\\"},{\\"disabled\\":false,\\"label\\":\\"随心聊\\",\\"value\\":\\"6\\"},{\\"disabled\\":false,\\"label\\":\\"效果加速器\\",\\"value\\":\\"7\\"},{\\"disabled\\":false,\\"label\\":\\"简历点\\",\\"value\\":\\"9\\"},{\\"disabled\\":false,\\"label\\":\\"劲爆单购\\",\\"value\\":\\"10\\"},{\\"disabled\\":false,\\"label\\":\\"普通单购\\",\\"value\\":\\"11\\"},{\\"disabled\\":false,\\"label\\":\\"个人超值套餐\\",\\"value\\":\\"12\\"},{\\"disabled\\":false,\\"label\\":\\"专享单购\\",\\"value\\":\\"13\\"},{\\"disabled\\":false,\\"label\\":\\"黄金\\",\\"value\\":\\"14\\"},{\\"disabled\\":false,\\"label\\":\\"置顶\\",\\"value\\":\\"15\\"}]','1','2024-09-19 10:49:01','lupeng10','2024-09-19 10:49:01','lupeng10','0',NULL,'0');
                insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id2}','1','url','跳转地址','1','${sceneId}',NULL,NULL,'2024-09-19 10:49:01','lupeng10','2024-09-19 10:49:01','lupeng10','0',NULL,'0');
                insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id3}','1','name','产品名称','1','${sceneId}',NULL,NULL,'2024-09-19 10:49:01','lupeng10','2024-09-19 10:49:01','lupeng10','0',NULL,'0');
                insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id4}','1','pageType','页面类型','7','${sceneId}','[{\\"disabled\\":false,\\"label\\":\\"弹窗\\",\\"value\\":\\"1\\"},{\\"disabled\\":false,\\"label\\":\\"跳转\\",\\"value\\":\\"2\\"},{\\"disabled\\":false,\\"label\\":\\"JSON\\",\\"value\\":\\"5\\"}]',NULL,'2024-09-19 10:49:01','lupeng10','2024-09-19 10:49:01','lupeng10','0',NULL,'0');
                """;
        Map<String, String> params = new HashMap<>();
        params.put("sceneId", "1827975735730548742");
        params.put("sceneKey", "zhaopin_qy_commerce_instructor_zcm_hongmeng_shelfupsuccess_commerce");
        params.put("sceneName", "招才猫鸿蒙-开启招聘商业推荐");

        long startId = 1832309930284085272L;
        for (int i = 1; i <= 22; i++) {
            params.put("id" + i, i + startId + "");
        }
        System.out.println(new StringSubstitutor(params).replace(sqlTem));

    }


    // 兼职全职使用一个
    // @Test
    // public void test2() {
    //     String sqlTem = """
    //             insert into `t_decision_scene` (`id`,`unikey`,`terminal`,`name`,`source`,`state`,`created_at`,`created_by`,`updated_at`,`updated_by`,`opportunity`,`field_supported`) values('${sceneId}','${sceneKey}',NULL,'${sceneName}','0','1','2024-09-11 14:42:04','lupeng10','2024-09-11 14:42:04','lupeng10','1',NULL);
    //
    //             insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id1}','1','pageType','页面类型','7','${sceneId}','[{\\"disabled\\":false,\\"label\\":\\"弹窗\\",\\"value\\":\\"1\\"},{\\"disabled\\":false,\\"label\\":\\"跳转\\",\\"value\\":\\"2\\"}]',NULL,'2024-09-11 14:42:04','lupeng10','2024-09-11 14:42:04','lupeng10','0',NULL,'0');
    //             insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id2}','1','name','产品名称','1','${sceneId}',NULL,NULL,'2024-09-11 14:42:04','lupeng10','2024-09-11 14:42:04','lupeng10','0',NULL,'0');
    //             insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id3}','1','url','跳转地址','1','${sceneId}',NULL,NULL,'2024-09-11 14:42:04','lupeng10','2024-09-11 14:42:04','lupeng10','0',NULL,'0');
    //             insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id4}','1','productType','商品类型','8','${sceneId}','[{\\"disabled\\":false,\\"label\\":\\"超级置顶\\",\\"value\\":\\"1\\"},{\\"disabled\\":false,\\"label\\":\\"畅聊权益\\",\\"value\\":\\"2\\"},{\\"disabled\\":false,\\"label\\":\\"超级畅聊职位\\",\\"value\\":\\"3\\"},{\\"disabled\\":false,\\"label\\":\\"超级畅聊职位月度包\\",\\"value\\":\\"4\\"},{\\"disabled\\":false,\\"label\\":\\"超级畅聊职位-安心招\\",\\"value\\":\\"5\\"},{\\"disabled\\":false,\\"label\\":\\"随心聊\\",\\"value\\":\\"6\\"},{\\"disabled\\":false,\\"label\\":\\"效果加速器\\",\\"value\\":\\"7\\"},{\\"disabled\\":false,\\"label\\":\\"简历点\\",\\"value\\":\\"9\\"},{\\"disabled\\":false,\\"label\\":\\"劲爆单购\\",\\"value\\":\\"10\\"},{\\"disabled\\":false,\\"label\\":\\"普通单购\\",\\"value\\":\\"11\\"},{\\"disabled\\":false,\\"label\\":\\"个人超值套餐\\",\\"value\\":\\"12\\"},{\\"disabled\\":false,\\"label\\":\\"专享单购\\",\\"value\\":\\"13\\"},{\\"disabled\\":false,\\"label\\":\\"黄金\\",\\"value\\":\\"14\\"},{\\"disabled\\":false,\\"label\\":\\"置顶\\",\\"value\\":\\"15\\"}]','1','2024-09-11 14:42:04','lupeng10','2024-09-11 14:42:04','lupeng10','0',NULL,'0');
    //             insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id5}','1','productType2','商业类型2(可选)','8','${sceneId}',NULL,'1','2024-09-11 14:42:04','lupeng10','2024-09-11 14:42:04','lupeng10','0',NULL,'0');
    //             insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id6}','1','conditionId','组合推荐','8','${sceneId}',NULL,'5','2024-09-11 14:42:04','lupeng10','2023-11-27 19:13:14','lupeng10','0',NULL,'0');
    //             """;
    //     Map<String, String> params = new HashMap<>();
    //     params.put("sceneId", "1827975735730548743");
    //     params.put("sceneKey", "zhaopin_qy_commerce_instructor_zcm_hongmeng_shelfupsuccess_commerce_jz");
    //     params.put("sceneName", "招才猫鸿蒙-开启招聘商业推荐-兼职");
    //
    //     long startId = 1832309930284085278L;
    //     for (int i = 1; i <= 22; i++) {
    //         params.put("id" + i, i + startId + "");
    //     }
    //     System.out.println(new StringSubstitutor(params).replace(sqlTem));
    // }

    @Test
    public void test3() {
        String sqlTem = """
                insert into `t_decision_scene` (`id`,`unikey`,`terminal`,`name`,`source`,`state`,`created_at`,`created_by`,`updated_at`,`updated_by`,`opportunity`,`field_supported`) values('${sceneId}','${sceneKey}',NULL,'${sceneName}','0','1','2024-09-11 14:42:04','lupeng10','2024-09-11 14:42:04','lupeng10','1',NULL);
                
                insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id1}','1','url','跳转地址','1','${sceneId}','null',NULL,'2023-12-19 15:12:15','xuecheng','2023-12-19 15:15:29','xuecheng','0',NULL,'0');
                insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id2}','1','pageType','页面类型','8','${sceneId}','[{\\"disabled\\":false,\\"label\\":\\"弹窗\\",\\"value\\":\\"1\\"},{\\"disabled\\":false,\\"label\\":\\"跳转\\",\\"value\\":\\"2\\"}]','7','2023-12-19 15:12:16','xuecheng','2023-12-19 15:15:29','xuecheng','0',NULL,'0');
                insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id3}','1','name','商品名称','1','${sceneId}','null',NULL,'2023-12-19 15:12:17','xuecheng','2023-12-19 15:15:30','xuecheng','0',NULL,'0');
                insert into `t_decision_scene_field` (`id`,`scope`,`field_key`,`field_name`,`field_type`,`scene_id`,`options`,`callback_url`,`created_at`,`created_by`,`updated_at`,`updated_by`,`parentId`,`cascade_control`,`cascade_field`) values('${id4}','1','productType','商品类型','8','${sceneId}','null','1','2023-12-19 15:12:17','xuecheng','2023-12-19 15:15:30','xuecheng','0',NULL,'0');
                """;
        Map<String, String> params = new HashMap<>();
        params.put("sceneId", "1827975735730548744");
        params.put("sceneKey", "zcm_hongmeng_go_see_shelfupsuccess_commerce");
        params.put("sceneName", "招才猫鸿蒙-开启招聘-去看看商业推荐");

        long startId = 1832309930284085285L;
        for (int i = 1; i <= 22; i++) {
            params.put("id" + i, i + startId + "");
        }
        System.out.println(new StringSubstitutor(params).replace(sqlTem));
    }

}
